package com.wc.alorithm_blue_bridge._思维.Q1372;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @Author congege
 * @Description 美丽的区间
 * https://www.lanqiao.cn/problems/1372/learning/?page=1&first_category_id=1&sort=students_count&second_category_id=8
 * @Date Created in 2023/10/31-21:56
 */
public class Main {
    static int maxLen = 100001;

    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        int S = sc.nextInt();
        int sum = 0;
        int ans = maxLen;
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        int left = 0;
        int right = 0;
        while (right < n) {
            sum += array[right];
            while (sum >= S) {
                ans = Math.min(ans, right - left + 1);
                if (ans == 1) {
                    right = n;
                    break;
                }
                sum -= array[left];
                left++;
            }
            right++;
        }

        if (ans == maxLen) {
            System.out.println(0);
        } else {
            System.out.println(ans);
        }
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
